<?php
include('connect.php');
$my_id = (int)$_GET['i'];
$ss="update sf_guard_user set is_online=1 where id = ".$my_id;
mysql_query($ss);
$ss="select id, from_id from chat_room where to_id=".$_GET['i']." and accept=0";
$ss="SELECT                      
    chat2_message.room_id
    FROM
    chat2_room_users
    Left Join chat2_message ON chat2_room_users.room_id = chat2_message.room_id
    WHERE
    chat2_room_users.user_id =  '$my_id' AND
    chat2_message.user_id <>  '$my_id' AND 
    chat2_message.read = 0";
$sd = "select account, gender from sf_guard_user where id = ".$my_id;
$red = mysql_query($sd);
list($account, $gender) = mysql_fetch_row($red);

$rez = mysql_query($ss);
$cnt = mysql_num_rows($rez); 

if($cnt>0) {                                                   
   list($room_id) = mysql_fetch_row($rez);   
   $s = "SELECT
        sf_guard_user.id,
        sf_guard_user.first_name
        FROM
        chat2_room_users
        Left Join sf_guard_user ON chat2_room_users.user_id = sf_guard_user.id
        WHERE
        chat2_room_users.room_id = '$room_id' AND
        chat2_room_users.user_id <> '$my_id'";
   $r = mysql_query($s);     
   list($id,$first_name) = mysql_fetch_row($r);
  
?>
   <div class="modal" id="yesno"> Call to chat from <a href="/profile/show?id=<?php echo $id?>"><?php echo $first_name ?></a><br /><br />

<div style="float: left">

</div>

<div style="float: right">
<?php if($account<=0 and $gender=='m'): ?>    
<a href="/chat/dispatcher.php">Accept the challenge to chat</a><br />
You account is not enough money!<br />
Top-up account, you can <a href="/en/account_index.html">hire</a><br />
<!--<a href="/chat/reject?id=<?= $id ?>">Cancel</a><br /> -->
<?php else: ?>
<a href="/chat/dispatcher.php">Accept the challenge to chat</a><br />
<!--
<a href="/chat/answer?video=yes&id=<?= $id ?>">Accept the challenge with video</a><br />
<a href="/chat/answer?video=no&id=<?= $id ?>">Accept the challenge without video</a><br />
<a href="/chat/reject?id=<?= $id ?>">Cancel</a><br />                                     -->  

<?php endif ?>
</div>

<object type="application/x-shockwave-flash" data="http://www.alika-love-agency.com/ump3player_500x70.swf" height="1" width="1"><param name="wmode" VALUE="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://www.alika-love-agency.com/ump3player_500x70.swf" /><param name="FlashVars" value="way=http://www.alika-love-agency.com/signal.mp3&amp;swf=http://www.alika-love-agency.com/ump3player_500x70.swf&amp;w=1&amp;h=0&amp;time_seconds=0&amp;autoplay=1&amp;q=&amp;skin=grey&amp;volume=70&amp;comment=" /></object>

<?php if($p!=''):?>
<div class="close" style="float:left"></div>
<img src="/uploads/users/avatar/_thumbnail/<?= $p ?>">
</div>
<?php endif ?>

<script>
$("#yesno").overlay({
    
    closeOnClick: true,   
    api: true
}).load();
</script>
<?php
}
else
{
   echo '';
}
?>